import string

def edit_distance(str1, str2):

    mat = [ [0 for i in range(len(str2) + 1)] for i in range(len(str1) + 1) ]

    for i in range(1, len(str1)+1):
        mat[i][0] = i

    for j in range(1, len(str2)+1):
        mat[0][j] = j

    sub_cost = 0
    for j in range(1, len(str2)+1):
        for i in range(1, len(str1)+1):
            if str1[i-1] == str2[j-1] :
                sub_cost = 0
            else:
                sub_cost = 1

            mat[i][j] = min(mat[i-1][j] + 1, mat[i][j-1] + 1, mat[i-1][j-1] + sub_cost)
    #print mat
    return mat[-1][-1]


STOPWORDS_LIST = [

    "a",
    "about",
    "above",
#    "after",
    "again",
    "against",
    "all",
    "am",
    "an",
#    "and",
#    "any",
    "are",
    "aren't",
	"arent",
    "as",
    "at",
    "be",
    "because",
    "been",
    "before",
    "being",
    "below",
    "between",
    "both",
    "but",
    "by",
    "can't",
	"cant",
    "cannot",
    "could",
    "couldn't",
	"couldnt",
    "did",
    "didn't",
	"didnt",
    "do",
    "does",
    "doesn't",
	"doesnt",
    "doing",
    "don't",
	"dont",
    "down",
    "during",
    "each",
    "few",
    "for",
#    "from",
#    "further",
    "had",
    "hadn't",
	"hadnt"
    "has",
    "hasn't",
	"hasnt",
    "have",
    "haven't",
	"havent",
    "having",
    "he",
    "he'd",
	"hed",
    "he'll",
	"hell",
    "he's",
	"hes",
    "her",
    "here",
    "here's",
	"heres",
    "hers",
    "herself",
    "him",
    "himself",
    "his",
    "how",
    "how's",
	"hows",
    "i",
    "i'd",
	"id",
    "i'll",
	"ill",
    "i'm",
	"im",
    "i've",
	"ive",
    "if",
    "in",
    "into",
    "is",
    "isn't",
	"isnt",
    "it",
    "it's",
    "its",
    "itself",
    "let's",
	"lets",
    "me",
    "more",
    "most",
    "mustn't",
	"musunt",
    "my",
    "myself",
    "no",
    "nor",
#    "not",
    "of",
    "off",
    "on",
    "once",
    "only",
    "or",
    "other",
    "ought",
    "our",
    "ours",
    "ourselves",
    "out",
    "over",
    "own",
    "same",
    "shan't",
	"shant",
    "she",
    "she'd",
	"shed",
    "she'll",
	"shell",
    "she's",
	"shes",
    "should",
    "shouldn't",
	"shouldnt",
    "so",
    "some",
    "such",
    "than",
    "that",
    "that's",
	"thats",
    "the",
    "their",
    "theirs",
    "them",
    "themselves",
    "then",
#    "there",
    "there's",
	"theres",
    "these",
    "they",
    "they'd",
	"theyd",
    "they'll",
	"theyll",
    "they're",
	"theyre",
    "they've",
	"theyve"
    "this",
    "those",
    "through",
#    "to",
    "too",
    "under",
    "until",
    "up",
    "very",
    "was",
    "wasn't",
	"wasnt",
    "we",
    "we'd",
	"wed",
    "we'll",
	"well",
    "we're",
    "we've",
	"weve",
    "were",
    "weren't",
	"werent",
#    "what",
#    "what's",
	"whats",
    "when",
    "when's",
	"whens",
#    "where",
#    "where's",
	"wheres",
    "which",
    "while",
    "who",
    "who's",
	"whos",
    "whom",
    "why",
    "why's",
	"whys",
    "with",
    "won't",
	"wont",
    "would",
    "wouldn't",
    "wouldnt",
    "you",
    "you'd",
    "youd",
    "you'll",
    "youll",
    "you're",
    "youre",
    "you've",
    "youve",
    "your",
    "yours",
    "yourself",
    "yourselves"
]


def strip_punc(str1):
    
    stripped_str = str1.translate(None, string.punctuation).strip()
    return stripped_str

def filter_stopwords(str_list):
    filter_list = list()
    for word in str_list:
        if word in STOPWORDS_LIST:
            print word
            continue
        filter_list.append(word)
    print filter_list
    return filter_list

